﻿@using CoreData
@model IList<Configuration>
@foreach (var item in Model)
{
    if (item.Code == "Logo")
    {
                <div class="row-form">   
                    <div class="span2">
                       Logo :</div>
                    <div class="span9">
                        <input id="fileupload" type="file" name="file" />
                        @if (item != null && item.Value != null && item.Value != "")
                        {
                            <div id="image">
                          <img src="@Url.Content("~/Media/CarpeDeal/" + item.Value)" width="70px" height="70px" alt="@item.Value" />
                            </div>
                        }
                        else
                        {
                                <div id="image"> 
                                 </div>
                        }
                     </div>
                    <div class="clear">
                    </div>
                </div>
             <script type="text/javascript">

                 $('#fileupload').fileupload({
                     dataType: 'json',
                     url: '/Administrator/GeneralConfigManagement/UploadFiles?dir=CarpeDeal',
                     autoUpload: true,
                     done: function (e, data) {
                         $('#image').html('<img width=\"70px\" height=\"70px\" src="/Media/CarpeDeal/' + data.result.name + '" />');

                     }
                 }).on('fileuploadprogressall', function (e, data) {
                     var progress = parseInt(data.loaded / data.total * 100, 10);
                     $('.progress .progress-bar').css('width', progress + '%');
                 });


             </script>
    }
    else if (item.Code == "EmailPassword")
    {
         <div class="row-form">
        <div class="span2">
            @item.Name :</div>
        <div class="span9">
            @Html.Password(item.Value, item.Value, new { @id = item.Code })</div>
        <div class="clear">
        </div>
    </div> 
    }
    else if (item.Code == "Paymentsetting")
    {
    <div class="row-form">
        <div class="span2">
            @item.Name :</div>
        <div class="span9">
            @Html.CheckBox(item.Code, Helper.ConvertObject.ToBool(item.Value), new { @id = item.Code })Check to use in real mode</div>
        <div class="clear">
        </div>
    </div> 
    }
    else if (item.Code == "Shutdownwebsite")
    {
    <div class="row-form">
        <div class="span2">
            @item.Name :</div>
        <div class="span9">
            @Html.CheckBox(item.Code, Helper.ConvertObject.ToBool(item.Value), new { @id = item.Code })Check to shut down website</div>
        <div class="clear">
        </div>
    </div> 
    }
    else
    {
         <div class="row-form">
        <div class="span2">
            @item.Name :</div>
        <div class="span9">
            @Html.TextBox(item.Value, item.Value, new { @id = item.Code })</div>
        <div class="clear">
        </div>
    </div> 
    }

}
<div class="row-form">
    <div class="span2">
    </div>
    <div class="span9">
        @if (Helper.SessionManagement.Value("pvalue").Contains("U") || Helper.SessionManagement.Value("pvalue").Contains("C"))
        {
            <input type="submit" class="btn btn-info span3 cmdupdategneral" value="Update" />}</div>
    <div class="clear">
    </div>
</div>
